<template>
  <div class="select">
    <ul>
      <li>
        <a href="#" @click="updateValues('PhotoA')">
          <i class="fa fa-facebook" aria-hidden="true"></i>
          <span style="font-size: 1vh;"> PhotoA</span>
        </a>
      </li>
      <li>
        <a href="#" @click="updateValues('PhotoB')">
          <i class="fa fa-twitter" aria-hidden="true"></i>
          <span style="font-size: 1vh;"> PhotoB</span>
        </a>
      </li>
      <li>
        <a href="#" @click="updateValues('Change')">
          <i class="fa fa-google-plus" aria-hidden="true"></i>
          <span style="font-size: 1vh;"> Change</span>
        </a>
      </li>
      <li>
        <a href="#">
          <i class="fa fa-instagram" aria-hidden="true"></i>
          <span style="font-size: 1vh;"> 2D⇌3D</span>
        </a>
      </li>
      <div>
        <!-- historyButton -->
        <button class="historyButton" @click="updateValues('History')">保存</button>
      </div>

    </ul>
  </div>
</template>

<script>
export default {
  name: 'PhotoSelect',
  methods: {
    updateValues(type) {
      let newValues = {};
      switch (type) {
        case 'PhotoA':
          newValues = { value0: 100, value1: 0, value2: 5 };
          break;
        case 'PhotoB':
          newValues = { value0: 0, value1: 100, value2: 5 };
          break;
        case 'Change':
          newValues = { value0: 100, value1: 0, value2: 30 };
          break;
      }
      this.$emit('update-values', newValues);
    }
  }
};
</script>

<style scoped>
.historyButton {
  position: fixed;
  top: 100%;
  left: 280%;
  transform: translate(-50%, -50%);
  background-color: white;
  border: none;
  color: black;
  padding: 15px 32px;
  text-align: center;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
  border-radius: 12px;
  box-shadow: 0 0.1vh 0.1vh rgb(155, 146, 146); /* 使用vh单位 */
}

.historyButton:hover {
  border-bottom: solid 0.2vh #0091eb; /* 使用vh单位 */
  border-right: solid 0.2vh #0091eb; /* 使用vh单位 */
  box-shadow: 0 0 0.8vh rgba(0, 145, 235, 0.6); /* 使用vh单位 */
  
}
.select {
  margin-top: 0vh;
  position: relative;
  margin-left: 100px;
}

ul {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  margin: 0;
  padding: 0;
}

ul li {
  list-style: none;
  margin: 0 0.5vw;
}

ul li a {
  text-decoration: none;
  display: block;
  width: 2.5vw;
  height: 1.25vw;
  padding-bottom: 0.5vh;
  background: #fff;
  text-align: left;
  padding-left: 1vw;
  transform: rotate(-30deg) skew(25deg) translate(0, 0);
  transition: .5s;
  box-shadow: -0.25vw 0.4vw 0.4vw rgba(0, 0, 0, .5);
}

ul li a:before {
  content: '';
  position: absolute;
  top: 0.25vw;
  left: -0.5vw;
  height: 100%;
  width: 0.5vw;
  background: #b1b1b1;
  transform: rotate(0deg) skewY(-45deg);
}

ul li a:after {
  content: '';
  position: absolute;
  bottom: -0.5vw;
  left: -0.25vw;
  height: 0.5vw;
  width: 100%;
  background: #b1b1b1;
  transform: rotate(0deg) skewX(-45deg);
}

ul li a .fa {
  font-size: 0.5vw;
  color: #262626;
  line-height: 1.25vw;
  transition: .5s;
  padding-right: 0.35vw;
}

ul li a span {
  padding: 0;
  margin: 0;
  position: absolute;
  top: 0.5vw;
  left: 0.25vw;
  color: #262626;
  letter-spacing: 0.1vw;
  font-size: 0.35vw;
  transition: .5s;
}

ul li a:hover {
  transform: rotate(-30deg) skew(25deg) translate(1vw, -0.75vw);
  box-shadow: -1.5vw 1.5vw 1.5vw rgba(0, 0, 0, .5);
}

ul li:hover .fa {
  color: #fff;
}

ul li:hover span {
  color: #fff;
}

ul li:hover:nth-child(1) a {
  background: #3b5998;
}

ul li:hover:nth-child(1) a:before {
  background: #365492;
}

ul li:hover:nth-child(1) a:after {
  background: #4a69ad;
}

ul li:hover:nth-child(2) a {
  background: #00aced;
}

ul li:hover:nth-child(2) a:before {
  background: #097aa5;
}

ul li:hover:nth-child(2) a:after {
  background: #53b9e0;
}

ul li:hover:nth-child(3) a {
  background: #dd4b39;
}

ul li:hover:nth-child(3) a:before {
  background: #b33a2b;
}

ul li:hover:nth-child(3) a:after {
  background: #e66a5a;
}

ul li:hover:nth-child(4) a {
  background: #e4405f;
}

ul li:hover:nth-child(4) a:before {
  background: #d81c3f;
}

ul li:hover:nth-child(4) a:after {
  background: #e46880;
}

/* 媒体查询用于调整小屏幕上的样式 */
@media (max-width: 600px) {
  ul {
    flex-direction: column;
  }

  ul li {
    margin: 1vh 0;
  }

  ul li a {
    width: 25vw;
    height: 10vw;
  }

  ul li a .fa {
    font-size: 4vw;
    line-height: 10vw;
  }

  ul li a span {
    font-size: 2.5vw;
    top: 5vw;
    left: 2.5vw;
  }
}
</style>